




/*
'===============================================================================
'  HNG.Portal.BL.TblNhaCungCapManagerBase
'===============================================================================
*/

using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using HNG.Portal.BLL;
using HNG.Portal.DAL;
using HNG.Portal.DAL.EntityClasses;
using HNG.Portal.DAL.FactoryClasses;
using HNG.Portal.DAL.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;
using System.Windows.Forms;
namespace HNG.Portal.BLL
{
	public class TblNhaCungCapManagerBase
	{
	    
		#region ColumnNames
		
				public const String Field_Id="Id";
				
				public const String Field_LangId="LangId";
				
				public const String Field_TenNhaCungCap="TenNhaCungCap";
				
				public const String Field_DiaChi="DiaChi";
				
				public const String Field_DienThoai="DienThoai";
				
				public const String Field_Website="Website";
				
				public const String Field_Image="Image";
				
				public const String Field_Mota="Mota";
				
				public const String Field_TrangThai="TrangThai";
				
		#endregion	
		/// <summary>
		/// Purpose: Class constructor.
		/// </summary>
		public TblNhaCungCapManagerBase()
		{
			// Nothing for now.
		}
		public DataTable Clone()
		{
			DataTable dt = new DataTable();
						
			
			dt.Columns.Add(Field_Id,typeof(int));
			
						
			
			dt.Columns.Add(Field_LangId,typeof(int));
			
						
			
			dt.Columns.Add(Field_TenNhaCungCap,typeof(string));
			
						
			
			dt.Columns.Add(Field_DiaChi,typeof(string));
			
						
			
			dt.Columns.Add(Field_DienThoai,typeof(string));
			
						
			
			dt.Columns.Add(Field_Website,typeof(string));
			
						
			
			dt.Columns.Add(Field_Image,typeof(string));
			
						
			
			dt.Columns.Add(Field_Mota,typeof(string));
			
						
			
			dt.Columns.Add(Field_TrangThai,typeof(bool));
			
			            
            return dt;			
		}
			
		public TblNhaCungCapEntity Convert_Entity(TblNhaCungCapEntity _TblNhaCungCapEntity,TblNhaCungCapEntity _TblNhaCungCapEntity_XML)
		{	
			
				
			_TblNhaCungCapEntity.Id= _TblNhaCungCapEntity_XML.Id;
				
			_TblNhaCungCapEntity.LangId= _TblNhaCungCapEntity_XML.LangId;
				
			_TblNhaCungCapEntity.TenNhaCungCap= _TblNhaCungCapEntity_XML.TenNhaCungCap;
				
			_TblNhaCungCapEntity.DiaChi= _TblNhaCungCapEntity_XML.DiaChi;
				
			_TblNhaCungCapEntity.DienThoai= _TblNhaCungCapEntity_XML.DienThoai;
				
			_TblNhaCungCapEntity.Website= _TblNhaCungCapEntity_XML.Website;
				
			_TblNhaCungCapEntity.Image= _TblNhaCungCapEntity_XML.Image;
				
			_TblNhaCungCapEntity.Mota= _TblNhaCungCapEntity_XML.Mota;
				
			_TblNhaCungCapEntity.TrangThai= _TblNhaCungCapEntity_XML.TrangThai;
				
			
			return _TblNhaCungCapEntity;
		}	
		
			
		public void InsertCollection(EntityCollection _Collection)
		{
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                adapter.SaveEntityCollection(_Collection);
            }
		}

		public TblNhaCungCapEntity Insert(TblNhaCungCapEntity TblNhaCungCapEntity)
		{
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.SaveEntity(TblNhaCungCapEntity, true);
			}
			return TblNhaCungCapEntity;
		}

		
		public TblNhaCungCapEntity Insert(int Id, int LangId, string TenNhaCungCap, string DiaChi, string DienThoai, string Website, string Image, string Mota, bool TrangThai)
		{
			TblNhaCungCapEntity _TblNhaCungCapEntity = new TblNhaCungCapEntity();
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				
				_TblNhaCungCapEntity.Id = Id;
				_TblNhaCungCapEntity.LangId = LangId;
				_TblNhaCungCapEntity.TenNhaCungCap = TenNhaCungCap;
				_TblNhaCungCapEntity.DiaChi = DiaChi;
				_TblNhaCungCapEntity.DienThoai = DienThoai;
				_TblNhaCungCapEntity.Website = Website;
				_TblNhaCungCapEntity.Image = Image;
				_TblNhaCungCapEntity.Mota = Mota;
				_TblNhaCungCapEntity.TrangThai = TrangThai;
				adapter.SaveEntity(_TblNhaCungCapEntity, true);
			}
			return _TblNhaCungCapEntity;
		}

		public TblNhaCungCapEntity Insert(int LangId, string TenNhaCungCap, string DiaChi, string DienThoai, string Website, string Image, string Mota, bool TrangThai)
		{
			TblNhaCungCapEntity _TblNhaCungCapEntity = new TblNhaCungCapEntity();
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				
				_TblNhaCungCapEntity.LangId = LangId;
				_TblNhaCungCapEntity.TenNhaCungCap = TenNhaCungCap;
				_TblNhaCungCapEntity.DiaChi = DiaChi;
				_TblNhaCungCapEntity.DienThoai = DienThoai;
				_TblNhaCungCapEntity.Website = Website;
				_TblNhaCungCapEntity.Image = Image;
				_TblNhaCungCapEntity.Mota = Mota;
				_TblNhaCungCapEntity.TrangThai = TrangThai;
				adapter.SaveEntity(_TblNhaCungCapEntity, true);
			}
			return _TblNhaCungCapEntity;
		}

		public bool Update(TblNhaCungCapEntity _TblNhaCungCapEntity)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				RelationPredicateBucket filter = new RelationPredicateBucket();
				IPredicateExpression _PredicateExpression = new PredicateExpression();
				_PredicateExpression.Add(TblNhaCungCapFields.Id == _TblNhaCungCapEntity.Id);
					
				filter.PredicateExpression.Add(_PredicateExpression);

				adapter.UpdateEntitiesDirectly(_TblNhaCungCapEntity, filter);
				toReturn = true;
			}
			return toReturn;
		}
		
		public bool Update(TblNhaCungCapEntity _TblNhaCungCapEntity, RelationPredicateBucket filter)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.UpdateEntitiesDirectly(_TblNhaCungCapEntity, filter);
				toReturn = true;
			}
			return toReturn;
		}

		public bool Update(int Id, int LangId, string TenNhaCungCap, string DiaChi, string DienThoai, string Website, string Image, string Mota, bool TrangThai)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				TblNhaCungCapEntity _TblNhaCungCapEntity = new TblNhaCungCapEntity(Id);
				if (adapter.FetchEntity(_TblNhaCungCapEntity))
				{
				
					_TblNhaCungCapEntity.LangId = LangId;
					_TblNhaCungCapEntity.TenNhaCungCap = TenNhaCungCap;
					_TblNhaCungCapEntity.DiaChi = DiaChi;
					_TblNhaCungCapEntity.DienThoai = DienThoai;
					_TblNhaCungCapEntity.Website = Website;
					_TblNhaCungCapEntity.Image = Image;
					_TblNhaCungCapEntity.Mota = Mota;
					_TblNhaCungCapEntity.TrangThai = TrangThai;
					adapter.SaveEntity(_TblNhaCungCapEntity, true);
					toReturn = true;
				}
			}
			return toReturn;
		}

		public bool Delete(int Id)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				TblNhaCungCapEntity _TblNhaCungCapEntity = new TblNhaCungCapEntity(Id);
				if (adapter.FetchEntity(_TblNhaCungCapEntity))
				{
					adapter.DeleteEntity(_TblNhaCungCapEntity);
					toReturn = true;
				}
			}
			return toReturn;
		}
		
		public void DeleteAll() 
		{
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.DeleteEntitiesDirectly("TblNhaCungCapEntity", null);
			}
		}
		
		
		public int DeleteById(int Id)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblNhaCungCapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByLangId(int LangId)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.LangId == LangId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblNhaCungCapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByTenNhaCungCap(string TenNhaCungCap)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.TenNhaCungCap == TenNhaCungCap);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblNhaCungCapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByDiaChi(string DiaChi)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.DiaChi == DiaChi);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblNhaCungCapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByDienThoai(string DienThoai)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.DienThoai == DienThoai);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblNhaCungCapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByWebsite(string Website)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.Website == Website);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblNhaCungCapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByImage(string Image)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.Image == Image);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblNhaCungCapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByMota(string Mota)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.Mota == Mota);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblNhaCungCapEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByTrangThai(bool TrangThai)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.TrangThai == TrangThai);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("TblNhaCungCapEntity", filter);
			}
			return toReturn;
		}
		

		
		public TblNhaCungCapEntity SelectOne(int Id)
		{
			TblNhaCungCapEntity toReturn = null;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				TblNhaCungCapEntity _TblNhaCungCapEntity = new TblNhaCungCapEntity(Id);
				if (adapter.FetchEntity(_TblNhaCungCapEntity))
				{
					toReturn = _TblNhaCungCapEntity;
				}
			}
			return toReturn;
		}

		// Return EntityCollection
		public EntityCollection SelectAll()
		{
			EntityCollection _TblNhaCungCapCollection = new EntityCollection( new TblNhaCungCapEntityFactory());
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblNhaCungCapCollection, null, 0, null);
			}
			return _TblNhaCungCapCollection;
		}
		
		// Return DataTable
		public DataTable SelectAllRDT()
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblNhaCungCapCollection.EntityFactoryToUse.CreateFields(), toReturn, null, true);
			}
			return toReturn;
		}

		
		// Return EntityCollection
		public EntityCollection SelectById(int Id)
		{
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblNhaCungCapCollection, filter, 0, null);
			}
			return _TblNhaCungCapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByIdRDT(int Id)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.Id == Id);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblNhaCungCapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByLangId(int LangId)
		{
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.LangId == LangId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblNhaCungCapCollection, filter, 0, null);
			}
			return _TblNhaCungCapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByLangIdRDT(int LangId)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.LangId == LangId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblNhaCungCapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByTenNhaCungCap(string TenNhaCungCap)
		{
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.TenNhaCungCap == TenNhaCungCap);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblNhaCungCapCollection, filter, 0, null);
			}
			return _TblNhaCungCapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByTenNhaCungCapRDT(string TenNhaCungCap)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.TenNhaCungCap == TenNhaCungCap);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblNhaCungCapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByDiaChi(string DiaChi)
		{
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.DiaChi == DiaChi);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblNhaCungCapCollection, filter, 0, null);
			}
			return _TblNhaCungCapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByDiaChiRDT(string DiaChi)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.DiaChi == DiaChi);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblNhaCungCapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByDienThoai(string DienThoai)
		{
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.DienThoai == DienThoai);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblNhaCungCapCollection, filter, 0, null);
			}
			return _TblNhaCungCapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByDienThoaiRDT(string DienThoai)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.DienThoai == DienThoai);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblNhaCungCapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByWebsite(string Website)
		{
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.Website == Website);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblNhaCungCapCollection, filter, 0, null);
			}
			return _TblNhaCungCapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByWebsiteRDT(string Website)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.Website == Website);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblNhaCungCapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByImage(string Image)
		{
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.Image == Image);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblNhaCungCapCollection, filter, 0, null);
			}
			return _TblNhaCungCapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByImageRDT(string Image)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.Image == Image);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblNhaCungCapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByMota(string Mota)
		{
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.Mota == Mota);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblNhaCungCapCollection, filter, 0, null);
			}
			return _TblNhaCungCapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByMotaRDT(string Mota)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.Mota == Mota);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblNhaCungCapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection
		public EntityCollection SelectByTrangThai(bool TrangThai)
		{
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.TrangThai == TrangThai);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_TblNhaCungCapCollection, filter, 0, null);
			}
			return _TblNhaCungCapCollection;
		}
		
		// Return DataTable
		public DataTable SelectByTrangThaiRDT(bool TrangThai)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _TblNhaCungCapCollection = new EntityCollection(new TblNhaCungCapEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(TblNhaCungCapFields.TrangThai == TrangThai);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_TblNhaCungCapCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		

	}
}
